
typedef struct SEGMENT_STRUCT
{
    unsigned _SEG_NEXT_HASH_GINDEX;	// NEXT SEGMENT THIS HASH
    #define _SEG_LEN	_SEG_NEXT_HASH_GINDEX
    unsigned _SEG_LAST_SEGMOD_GINDEX;	// NEXT SEGMENT THIS CLASS

    unsigned _SEG_CLASS_GINDEX;			// CLASS POINTER
    struct GROUP_STRUCT *_SEG_GROUP_GINDEX;	// GROUP AFFILLIATION

    unsigned _SEG_OFFSET;		// OFFSET FROM FRAME FOR SEGMENTED, ELSE REAL ADDRESS

    unsigned _SEG_OS2_NUMBER;		// SEGMENT NUMBER (DWORD FRAME ADDRESS IN REAL MODE AND FOR ASEGS) (PE_SECTION)
    unsigned _SEG_OS2_FLAGS;		// PRELOAD, MOVABLE, ETC

    unsigned _SEG_FIRST_SEGMOD_GINDEX;
    struct SEGMENT_STRUCT *_SEG_NEXT_SEG_GINDEX;

#if fg_rom
    unsigned _SEG_PHASE;
#endif

#if fg_plink
    unsigned _SEG_SECTION_GINDEX;	// ASSIGNED SECTION

    unsigned char _SEG_PLTYPE;		// (PLTYPES RECORD)
    unsigned char _SEG_32FLAGS;
    unsigned short reserved1;

#else

    unsigned char _SEG_32FLAGS;		// SEG32_FLAGS_REC (USE_32, ETC)
    unsigned char reserved1;
    unsigned short reserved2;
#endif

    unsigned _SEG_CV_NUMBER;		// SEGMENT # FOR 16-BIT CODEVIEW...
#if fg_cv
    _SEG_NEXT_CV_GINDEX;		// NEXT SEGMENT CV ORDER (FOR OLD 16-BIT COMPATIBILITY)
#endif
    unsigned char _SEG_ORDER_FLAG;	// ORDERING STUFF
    unsigned char _SEG_MAX_ALIGN;	// MAXIMUM ALIGNMENT THIS SEGMENT
    unsigned char _SEG_COMBINE;		// SEGMENT ATTRIBUTES(PUBLIC, STACK, PRIVATE)
    unsigned char _SEG_TYPE;		// ASEG, RELOC, UNDEFINED

    unsigned _SEG_HASH; 
    unsigned _SEG_TEXT;			// ACTUAL NAME...
} SEGMENT_STRUCT; 			// ***** MUST BE EVEN WORDS *****


#define _SEG_FRAME	_SEG_OS2_NUMBER

#define _SEG_PEOBJECT_NUMBER	_SEG_CV_NUMBER
#define _SEG_PEOBJECT_GINDEX	_SEG_OS2_NUMBER

/*
SEG32_FLAGS_REC	RECORD	SEG32_USE16:1,SEG32_NONZERO:1,SEG32_USE32:1

DEF_RECORD	RECORD	DEF_NEXT_DIFFERENT:1,DEF_ORDERED:1,DEF_ORGED:1,\
		DEF_OMITTED:1,DEF_PHASEE:1,DEF_PHASE_TARG:1,\
		DEF_OS2_DEFINED:1,DEF_ALIGNED:1

if	fg_segm

SEGREC	RECORD	SR_1:1,SR_HUGE:1,SR_32:1,SR_DISCARD:1,SR_DPL:2,SR_CONF:1,SR_RELOC:1,SR_EO_RO:1,SR_PRELOAD:1,SR_SHARED:1,SR_MOVABLE:1,SR_ITERATE:1,SR_TYPE:3

;SEGREC	RECORD	SR_1:1,\	;??? USED BY FIXUPP2 AS 'IMPORTED' FLAG
;		SR_HUGE:1,\	;SEGMENT IS HUGE
;		SR_32:1,\	;SEGMENT IS 32-BIT
;		SR_DISCARD:1,\	;SEGMENT IS DISCARDABLE
;		SR_DPL:2,\	;286 DPL BITS???
;		SR_CONF:1,\	;SEGMENT IS CONFORMING
;		SR_RELOC:1,\	;SEGMENT HAS RELOCATION RECORDS
;		SR_EO_RO:1,\	;SEGMENT IS EXECUTE-ONLY, OR READ-ONLY
;		SR_PRELOAD:1,\	;SEGMENT PRELOADS
;		SR_SHARED:1,\	;SEGMENT IS SHARABLE
;		SR_MOVABLE:1,\	;SEGMENT IS MOVABLE
;		SR_ITERATE:1,\	;SEGMENT IS ITERATED
;		SR_TYPE:3	;SEGMENT TYPE 0=CODE, 1=DATA

SEGREC1 RECORD	SR_2:13,SR_MULTIPLE:2,SR_3:1

SR_READ		EQU	<SR_HUGE>	;JUST DURING .DEF PROCESSING
SR_WRITE	EQU	<SR_RELOC>	;
SR_EXECUTE	EQU	<SR_ITERATE>	;

endif

typedef struct SEGMOD_STRUCT		// **** MUST MAKE SURE CDDATA MATCHES ****
{
_SM_BASE_SEG_GINDEX	DD	?	;PTR BACK TO BASE SEGMENT
_SM_NEXT_SEGMOD_GINDEX	DD	?	;NEXT SEGMOD THIS SEGMENT OR SECTION

_SM_START		DD	?	;OFFSET FROM FRAME IF SEGMENTED, ELSE REAL ADDRESS
_SM_LEN			DD	?	;LENGTH THIS PIECE - LATER LENGTH + SM_START
_SM_FIRST_DAT		DD	?	;LEDATA, LIDATA, FIXUPP, FORREF (VM)

_SM_SECTION_GINDEX	DD	?	;NEED THIS EVEN WITHOUT OVERLAYS...

_SM_PLTYPE		DB	?	;(PLTYPES RECORD)
_SM_FLAGS_2		DB	?	;CSEG DEFINED
_SM_ALIGN		DB	?	;ALIGN THIS PIECE
_SM_FLAGS		DB	?	;

_SM_MODULE_CSEG_GINDEX	DD	?	;OWNING MODULE, OR DEBUG CSEG PTR

_SM_COMDAT_LINK		DD	?

} SEGMOD_STRUCT;	// ***** MUST MAKE SURE CDDATA MATCHES *****

_SM_RELOC_CNT	EQU	_SM_START		;HERE CAUSE SECTION MAY NOT BE ASSIGNED YET...
*/

#define	SEG_CV_TYPES1	0x80
#define	SEG_CV_SYMBOLS1	0x40
#define	SEG_IN_DGROUP	0x20
#define	SEG_CLASS_IS_CODE 0x10
#define	SEG_CONST	8
#define	SEG_RELOC	4
#define	SEG_ASEG	2
#define	SEG_MOVEABLE	1

/*
SM_REC_2	RECORD	SM2_COMDAT:1,SM2_DATA_IN_CODE:1,SM2_CSEG_DONE:1

SC_PRIVATE	EQU	0
SC_MEMORY	EQU	1	;TREATED LIKE PUBLIC
SC_PUBLIC	EQU	2	;
SC_STACK	EQU	5	;
SC_COMMON	EQU	6
SC_ABSOLUTE	EQU	0FEH
SC_UNDEFINED	EQU	0FFH

SA_ABSOLUTE	EQU	0	;
SA_BYTE 	EQU	1	;  1
SA_WORD 	EQU	2	;  2
SA_PARA 	EQU	3	; 16
SA_PAGE 	EQU	4	;256
SA_DWORD	EQU	5	;  4
SA_4K		EQU	6	;999

*/
